package Simple2;

public class Look_and_say {

	
	public static String lookandsay(String number){
		StringBuilder result= new StringBuilder();
	 
		char temp= number.charAt(0);
		number= number.substring(1) + " ";
		int flag= 1;
	 
		for(char actual: number.toCharArray()){
			if(actual != temp){
				result.append(flag + "" + temp);
				flag= 1;
				temp= actual;
			}else{
				flag+= 1;
			}
		}
		return result.toString();
	}
	
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String num = "1"; 
		 
		for (int i=1;i<=10;i++) {
			System.out.println(num);
			num = lookandsay(num);             
		}
	}

}
